package main

import (
	"strings"
)

//https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
//寻找最长不含有重复字符的子串
//abcabcbb -> abc
//bbbbbbb -> b
//pwwkew -> wke

//错的，例如：dvdf
func lengthOfLongestSubstring_self(s string) map[string]int {
	d := make(map[string]int)
	var k string

	for _, c := range s {
		if strings.Contains(k, string(c)) {
			k = string(c)
			d[k] = len(k)
		} else {
			k += string(c)
			d[k] = len(k)
		}
	}
	return d
}

//func main() {
//	s := "abcabcbb"
//	d := lengthOfLongestSubstring_self(s)
//	fmt.Println(d)
//}
